package cn.jinjimi.app.main.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListAdapter;

import cn.jinjimi.app.main.adapter.ZdbCommonListAdapter;
import cn.jinjimi.app.main.widget.XListView.XListView;

/**
 * Created by lforxeverc on 16/8/29.
 */
public class ZdbXListView extends XListView {
    private ZdbCommonListAdapter mAdapter;
    public ZdbXListView(Context context) {
        this(context,null);
    }

    public ZdbXListView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public ZdbXListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (mAdapter != null && mAdapter.isBlockClick()) {
            mAdapter.resetView();
            mAdapter.resetStatus();
            return true;
        }
        return super.onTouchEvent(ev);
    }

    @Override
    public void setAdapter(ListAdapter adapter) {
        super.setAdapter(adapter);
        mAdapter = (ZdbCommonListAdapter) adapter;
    }
}
